package com.ly.monogoDB;

import java.io.IOException;
import java.util.List;

import org.jdom.JDOMException;

import com.ly.test.Person;

public class MonogoDB {
	public static final String tableName = "system";
	public static final String path = "mini-mongodb.xml";
	public static MyMonogoDb db = new MyMonogoDb();
	public static String _uuid = "67ba4a8bb4c2453c9cadf7580c3ff40b";
	public static void main(String[] args) {

		
		
		
		try {
			//db.createData(path);
			//addData();
			List list = db.findAll(path, tableName);
			System.out.println(list);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public static void addData() throws Exception{
		Person person = new Person();
		person.setAge(20);
		person.setName("舒月");
		person.setMoney(2536.36);
		db.addData(path, tableName, person);
	}
	public static void deleteData() throws Exception{
		Person person = new Person();
		person.setUuid(_uuid);
		db.deleteData(path, tableName, person);

	}
	public static void updateDate() throws Exception, IOException{
		Person person = new Person();
		person.setAge(220);
		person.setName("舒月eqq");
		person.setMoney(2536.36111);
		person.setUuid(_uuid);
		db.updateData(path, tableName, person);
		
	}

}
